package br.ufpb.di.ppgi.persistencia;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.Container;
import br.ufpb.di.ppgi.persistencia.iquery.IAlunoQuery;
import br.ufpb.di.ppgi.persistencia.iquery.IDefesaQuery;
import br.ufpb.di.ppgi.persistencia.iquery.IProfessorExternoQuery;
import br.ufpb.di.ppgi.persistencia.iquery.IPropostaQuery;
import br.ufpb.di.ppgi.persistencia.iquery.IQuery;
import br.ufpb.di.ppgi.persistencia.iquery.IUsuarioQuery;

@Component
public class QueryLocator {
	private final Container container;
	
	public QueryLocator(Container container) {
		this.container = container;
	}
	
	protected <E extends IQuery> E on(Class<E> target) {
		return container.instanceFor(target);
	}
	
	public IUsuarioQuery forUsuario() {
		return on(IUsuarioQuery.class);
	}
	
	public IAlunoQuery forAluno() {
		return on(IAlunoQuery.class);
	}

	public IPropostaQuery forProposta() {
		return on (IPropostaQuery.class);
	}
	
	public IProfessorExternoQuery forProfessorExterno() {
		return on (IProfessorExternoQuery.class);
	}
	
	public IDefesaQuery forDefesa() {
		return on(IDefesaQuery.class);
	}
}
